<!DOCTYPE html>
<html>
	<head>
		<meta charset="UTF-8">
		<title>angularJS测试一,双向绑定</title>
		<script type="text/javascript" src="../js/angular.min.js" ></script>
	</head>
	<body >
		<!--定义一个模块-->
		<div ng-app="myapp" ng-controller="myctrl">
			<div>
				<!--定义个标签-->
				<input type="text" name="username" ng-model="name" />
				<!--提供一个按钮，点击事件的绑定-->
				<input type="button" value="清空" ng-click="clearVal()"/>
			</div>
			<div>
				hello,{{name}}
			</div>
		</div>
		<script type="text/javascript">
			//初始化模块
			var myapp=angular.module("myapp",[]);
			//定义模块控制器，依赖注入域对象
			myapp.controller("myctrl",["$scope",function($scope){
				//定义域内的值
				$scope.name="世界";
				$scope.clearVal=function(){
					//将值变为空
					$scope.name="";
				}
			}])
		</script>
	</body>
</html>
